<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>killerbee.dev_wislab</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="killerbee-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/killerbee/">KillerBee</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="killerbee-module.html">Package&nbsp;killerbee</a> ::
        Module&nbsp;dev_wislab
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="killerbee.dev_wislab-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="killerbee.dev_wislab-module.html">Module killerbee.dev_wislab</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment"># KillerBee Device Support for:</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"># Wislab Sniffer Radio Client</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"># This sniffer is a remote IPv4 host.</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"># </tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"># (C) 2013 Ryan Speers &lt;ryan at riverloopsecurity.com&gt;</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"># For documentation from the vendor, visit:</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment">#   http://www.sniffer.wislab.cz/sniffer-configuration/</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">struct</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">time</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">urllib2</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">socket</tt> <tt class="py-keyword">import</tt> <tt class="py-name">socket</tt><tt class="py-op">,</tt> <tt class="py-name">AF_INET</tt><tt class="py-op">,</tt> <tt class="py-name">SOCK_DGRAM</tt><tt class="py-op">,</tt> <tt class="py-name">SOL_SOCKET</tt><tt class="py-op">,</tt> <tt class="py-name">SO_REUSEADDR</tt><tt class="py-op">,</tt> <tt id="link-0" class="py-name" targets="Method killerbee.GoodFET.GoodFET.timeout()=killerbee.GoodFET.GoodFET-class.html#timeout"><a title="killerbee.GoodFET.GoodFET.timeout" class="py-name" href="#" onclick="return doclink('link-0', 'timeout', 'link-0');">timeout</a></tt> <tt class="py-keyword">as</tt> <tt class="py-name">error_timeout</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">struct</tt> <tt class="py-keyword">import</tt> <tt class="py-name">unpack</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">datetime</tt> <tt class="py-keyword">import</tt> <tt class="py-name">datetime</tt><tt class="py-op">,</tt> <tt class="py-name">date</tt><tt class="py-op">,</tt> <tt class="py-name">timedelta</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Module killerbee.kbutils=killerbee.kbutils-module.html"><a title="killerbee.kbutils" class="py-name" href="#" onclick="return doclink('link-1', 'kbutils', 'link-1');">kbutils</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Class killerbee.kbutils.KBCapabilities=killerbee.kbutils.KBCapabilities-class.html"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-2', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name" targets="Function killerbee.kbutils.makeFCS()=killerbee.kbutils-module.html#makeFCS"><a title="killerbee.kbutils.makeFCS" class="py-name" href="#" onclick="return doclink('link-3', 'makeFCS', 'link-3');">makeFCS</a></tt><tt class="py-op">,</tt> <tt id="link-4" class="py-name" targets="Function killerbee.kbutils.isIpAddr()=killerbee.kbutils-module.html#isIpAddr"><a title="killerbee.kbutils.isIpAddr" class="py-name" href="#" onclick="return doclink('link-4', 'isIpAddr', 'link-4');">isIpAddr</a></tt><tt class="py-op">,</tt> <tt id="link-5" class="py-name" targets="Class killerbee.kbutils.KBInterfaceError=killerbee.kbutils.KBInterfaceError-class.html"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-5', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable killerbee.dev_wislab.DEFAULT_IP=killerbee.dev_wislab-module.html#DEFAULT_IP"><a title="killerbee.dev_wislab.DEFAULT_IP" class="py-name" href="#" onclick="return doclink('link-6', 'DEFAULT_IP', 'link-6');">DEFAULT_IP</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"10.10.10.2"</tt>   <tt class="py-comment">#IP address of the sniffer</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable killerbee.dev_wislab.DEFAULT_GW=killerbee.dev_wislab-module.html#DEFAULT_GW"><a title="killerbee.dev_wislab.DEFAULT_GW" class="py-name" href="#" onclick="return doclink('link-7', 'DEFAULT_GW', 'link-7');">DEFAULT_GW</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"10.10.10.1"</tt>   <tt class="py-comment">#IP address of the default gateway</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable killerbee.dev_wislab.DEFAULT_UDP=killerbee.dev_wislab-module.html#DEFAULT_UDP"><a title="killerbee.dev_wislab.DEFAULT_UDP" class="py-name" href="#" onclick="return doclink('link-8', 'DEFAULT_UDP', 'link-8');">DEFAULT_UDP</a></tt> <tt class="py-op">=</tt> <tt class="py-number">17754</tt>         <tt class="py-comment">#"Remote UDP Port"</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt id="link-9" class="py-name" targets="Variable killerbee.dev_wislab.TESTED_FW_VERS=killerbee.dev_wislab-module.html#TESTED_FW_VERS"><a title="killerbee.dev_wislab.TESTED_FW_VERS" class="py-name" href="#" onclick="return doclink('link-9', 'TESTED_FW_VERS', 'link-9');">TESTED_FW_VERS</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">"0.5"</tt><tt class="py-op">]</tt>    <tt class="py-comment">#Firmware versions tested with the current version of this client device connector</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt id="link-10" class="py-name" targets="Variable killerbee.dev_wislab.NTP_DELTA=killerbee.dev_wislab-module.html#NTP_DELTA"><a title="killerbee.dev_wislab.NTP_DELTA" class="py-name" href="#" onclick="return doclink('link-10', 'NTP_DELTA', 'link-10');">NTP_DELTA</a></tt> <tt class="py-op">=</tt> <tt class="py-number">70</tt><tt class="py-op">*</tt><tt class="py-number">365</tt><tt class="py-op">*</tt><tt class="py-number">24</tt><tt class="py-op">*</tt><tt class="py-number">60</tt><tt class="py-op">*</tt><tt class="py-number">60</tt> <tt class="py-comment">#datetime(1970, 1, 1, 0, 0, 0) - datetime(1900, 1, 1, 0, 0, 0)</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-string">'''</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-string">Convert the two parts of an NTP timestamp to a datetime object.</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-string">Similar code from Wireshark source:</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-string">575     /* NTP_BASETIME is in fact epoch - ntp_start_time */</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt class="py-string">576     #define NTP_BASETIME 2208988800ul</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt class="py-string">619     void</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt class="py-string">620     ntp_to_nstime(tvbuff_t *tvb, gint offset, nstime_t *nstime)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-string">621     {</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-string">622     nstime-&gt;secs = tvb_get_ntohl(tvb, offset);</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt class="py-string">623     if (nstime-&gt;secs)</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-string">624     nstime-&gt;secs -= NTP_BASETIME;</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-string">625     nstime-&gt;nsecs = (int)(tvb_get_ntohl(tvb, offset+4)/(NTP_FLOAT_DENOM/1000000000.0));</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-string">626     }</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-string">'''</tt> </tt>
<a name="ntp_to_system_time"></a><div id="ntp_to_system_time-def"><a name="L44"></a><tt class="py-lineno"> 44</tt> <a class="py-toggle" href="#" id="ntp_to_system_time-toggle" onclick="return toggle('ntp_to_system_time');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab-module.html#ntp_to_system_time">ntp_to_system_time</a><tt class="py-op">(</tt><tt class="py-param">secs</tt><tt class="py-op">,</tt> <tt class="py-param">msecs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ntp_to_system_time-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ntp_to_system_time-expanded"><a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-docstring">"""convert a NTP time to system time"""</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"Secs:"</tt><tt class="py-op">,</tt> <tt class="py-name">secs</tt><tt class="py-op">,</tt> <tt class="py-name">msecs</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">    <tt class="py-keyword">print</tt> <tt class="py-string">"\tUTC:"</tt><tt class="py-op">,</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">utcfromtimestamp</tt><tt class="py-op">(</tt><tt class="py-name">secs</tt> <tt class="py-op">-</tt> <tt class="py-number">2208988800</tt><tt class="py-op">)</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">utcfromtimestamp</tt><tt class="py-op">(</tt><tt class="py-name">secs</tt> <tt class="py-op">-</tt> <tt class="py-number">2208988800</tt><tt class="py-op">)</tt> </tt>
</div><a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"> </tt>
<a name="getFirmwareVersion"></a><div id="getFirmwareVersion-def"><a name="L50"></a><tt class="py-lineno"> 50</tt> <a class="py-toggle" href="#" id="getFirmwareVersion-toggle" onclick="return toggle('getFirmwareVersion');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab-module.html#getFirmwareVersion">getFirmwareVersion</a><tt class="py-op">(</tt><tt class="py-param">ip</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="getFirmwareVersion-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="getFirmwareVersion-expanded"><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-name">html</tt> <tt class="py-op">=</tt> <tt class="py-name">urllib2</tt><tt class="py-op">.</tt><tt class="py-name">urlopen</tt><tt class="py-op">(</tt><tt class="py-string">"http://{0}/"</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">ip</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-name">fw</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">search</tt><tt class="py-op">(</tt><tt class="py-string">r'Firmware version ([0-9.]+)'</tt><tt class="py-op">,</tt> <tt class="py-name">html</tt><tt class="py-op">.</tt><tt id="link-11" class="py-name" targets="Method killerbee.GoodFET.GoodFETbtser.read()=killerbee.GoodFET.GoodFETbtser-class.html#read,Method killerbee.openear.gps.client.gpscommon.read()=killerbee.openear.gps.client.gpscommon-class.html#read,Method killerbee.zbwardrive.gps.client.gpscommon.read()=killerbee.zbwardrive.gps.client.gpscommon-class.html#read"><a title="killerbee.GoodFET.GoodFETbtser.read
killerbee.openear.gps.client.gpscommon.read
killerbee.zbwardrive.gps.client.gpscommon.read" class="py-name" href="#" onclick="return doclink('link-11', 'read', 'link-11');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">fw</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">fw</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt> <tt class="py-keyword">as</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"Unable to connect to IP {0} (error: {1})."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">ip</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"> </tt>
<a name="getMacAddr"></a><div id="getMacAddr-def"><a name="L60"></a><tt class="py-lineno"> 60</tt> <a class="py-toggle" href="#" id="getMacAddr-toggle" onclick="return toggle('getMacAddr');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab-module.html#getMacAddr">getMacAddr</a><tt class="py-op">(</tt><tt class="py-param">ip</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="getMacAddr-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="getMacAddr-expanded"><a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">    <tt class="py-docstring">'''</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">    Returns a string for the MAC address of the sniffer.</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">    '''</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">        <tt class="py-name">html</tt> <tt class="py-op">=</tt> <tt class="py-name">urllib2</tt><tt class="py-op">.</tt><tt class="py-name">urlopen</tt><tt class="py-op">(</tt><tt class="py-string">"http://{0}/"</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">ip</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-comment"># Yup, we're going to have to steal the status out of a JavaScript variable</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-comment">#var values = removeSSItag('&lt;!--#pindex--&gt;STOPPED,00:1a:b6:00:0a:a4,...</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">search</tt><tt class="py-op">(</tt><tt class="py-string">r'&lt;!--#pindex--&gt;[A-Z]+,((?:[0-9a-f]{2}:){5}[0-9a-f]{2})'</tt><tt class="py-op">,</tt> <tt class="py-name">html</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="killerbee.GoodFET.GoodFETbtser.read
killerbee.openear.gps.client.gpscommon.read
killerbee.zbwardrive.gps.client.gpscommon.read" class="py-name" href="#" onclick="return doclink('link-12', 'read', 'link-11');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">res</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-13" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-13', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unable to parse the sniffer's MAC address."</tt><tt class="py-op">)</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">res</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt> <tt class="py-keyword">as</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"Unable to connect to IP {0} (error: {1})."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">ip</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"> </tt>
<a name="isWislab"></a><div id="isWislab-def"><a name="L76"></a><tt class="py-lineno"> 76</tt> <a class="py-toggle" href="#" id="isWislab-toggle" onclick="return toggle('isWislab');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab-module.html#isWislab">isWislab</a><tt class="py-op">(</tt><tt class="py-param">dev</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="isWislab-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="isWislab-expanded"><a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt> <tt id="link-14" class="py-name"><a title="killerbee.kbutils.isIpAddr" class="py-name" href="#" onclick="return doclink('link-14', 'isIpAddr', 'link-4');">isIpAddr</a></tt><tt class="py-op">(</tt><tt class="py-name">dev</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt id="link-15" class="py-name" targets="Function killerbee.dev_wislab.getFirmwareVersion()=killerbee.dev_wislab-module.html#getFirmwareVersion"><a title="killerbee.dev_wislab.getFirmwareVersion" class="py-name" href="#" onclick="return doclink('link-15', 'getFirmwareVersion', 'link-15');">getFirmwareVersion</a></tt><tt class="py-op">(</tt><tt class="py-name">dev</tt><tt class="py-op">)</tt> <tt class="py-op">!=</tt> <tt class="py-name">None</tt> <tt class="py-op">)</tt> </tt>
</div><a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="WISLAB"></a><div id="WISLAB-def"><a name="L79"></a><tt class="py-lineno"> 79</tt> <a class="py-toggle" href="#" id="WISLAB-toggle" onclick="return toggle('WISLAB');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html">WISLAB</a><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="WISLAB-expanded"><a name="WISLAB.__init__"></a><div id="WISLAB.__init__-def"><a name="L80"></a><tt class="py-lineno"> 80</tt> <a class="py-toggle" href="#" id="WISLAB.__init__-toggle" onclick="return toggle('WISLAB.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">dev</tt><tt class="py-op">=</tt><tt id="link-16" class="py-name"><a title="killerbee.dev_wislab.DEFAULT_IP" class="py-name" href="#" onclick="return doclink('link-16', 'DEFAULT_IP', 'link-6');">DEFAULT_IP</a></tt><tt class="py-op">,</tt> <tt class="py-param">recvport</tt><tt class="py-op">=</tt><tt id="link-17" class="py-name"><a title="killerbee.dev_wislab.DEFAULT_UDP" class="py-name" href="#" onclick="return doclink('link-17', 'DEFAULT_UDP', 'link-8');">DEFAULT_UDP</a></tt><tt class="py-op">,</tt> <tt class="py-param">recvip</tt><tt class="py-op">=</tt><tt id="link-18" class="py-name"><a title="killerbee.dev_wislab.DEFAULT_GW" class="py-name" href="#" onclick="return doclink('link-18', 'DEFAULT_GW', 'link-7');">DEFAULT_GW</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__init__-expanded"><a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"><tt class="py-docstring">        Instantiates the KillerBee class for the Wislab Sniffer.</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-docstring">        @type dev:   String</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-docstring">        @param dev:  IP address (ex 10.10.10.2)</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-docstring">        @type recvport: Integer</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-docstring">        @param recvport: UDP port to listen for sniffed packets on.</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-docstring">        @type recvip: String</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line"><tt class="py-docstring">        @param recvip: IP address of the host, where the sniffer will send sniffed packets to.</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line"><tt class="py-docstring">        @return: None</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_channel</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_modulation</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> <tt class="py-comment">#unknown, will be set by change channel currently</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt> <tt class="py-op">=</tt> <tt class="py-name">dev</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">         </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-comment">#TODO The receive port and receive IP address are currently not </tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-comment"># obtained from or verified against the Wislab sniffer, nor are they</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-comment"># used to change the settings on the sniffer.</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">udp_recv_port</tt> <tt class="py-op">=</tt> <tt class="py-name">recvport</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">udp_recv_ip</tt>   <tt class="py-op">=</tt> <tt class="py-name">recvip</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line"> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__revision_num</tt> <tt class="py-op">=</tt> <tt id="link-19" class="py-name"><a title="killerbee.dev_wislab.getFirmwareVersion" class="py-name" href="#" onclick="return doclink('link-19', 'getFirmwareVersion', 'link-15');">getFirmwareVersion</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">)</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__revision_num</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt id="link-20" class="py-name"><a title="killerbee.dev_wislab.TESTED_FW_VERS" class="py-name" href="#" onclick="return doclink('link-20', 'TESTED_FW_VERS', 'link-9');">TESTED_FW_VERS</a></tt><tt class="py-op">:</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"Warning: Firmware revision {0} reported by the sniffer is not currently supported. Errors may occur and dev_wislab.py may need updating."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__revision_num</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt> <tt class="py-op">=</tt> <tt class="py-name">socket</tt><tt class="py-op">(</tt><tt class="py-name">AF_INET</tt><tt class="py-op">,</tt> <tt class="py-name">SOCK_DGRAM</tt><tt class="py-op">)</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">.</tt><tt class="py-name">setsockopt</tt><tt class="py-op">(</tt><tt class="py-name">SOL_SOCKET</tt><tt class="py-op">,</tt> <tt class="py-name">SO_REUSEADDR</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">.</tt><tt class="py-name">bind</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">udp_recv_ip</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">udp_recv_port</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt> <tt class="py-op">=</tt> <tt id="link-21" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-21', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Method killerbee.dev_apimote.APIMOTE.__set_capabilities()=killerbee.dev_apimote.APIMOTE-class.html#__set_capabilities,Method killerbee.dev_freakduino.FREAKDUINO.__set_capabilities()=killerbee.dev_freakduino.FREAKDUINO-class.html#__set_capabilities,Method killerbee.dev_rzusbstick.RZUSBSTICK.__set_capabilities()=killerbee.dev_rzusbstick.RZUSBSTICK-class.html#__set_capabilities,Method killerbee.dev_telosb.TELOSB.__set_capabilities()=killerbee.dev_telosb.TELOSB-class.html#__set_capabilities,Method killerbee.dev_wislab.WISLAB.__set_capabilities()=killerbee.dev_wislab.WISLAB-class.html#__set_capabilities,Method killerbee.dev_zigduino.ZIGDUINO.__set_capabilities()=killerbee.dev_zigduino.ZIGDUINO-class.html#__set_capabilities"><a title="killerbee.dev_apimote.APIMOTE.__set_capabilities
killerbee.dev_freakduino.FREAKDUINO.__set_capabilities
killerbee.dev_rzusbstick.RZUSBSTICK.__set_capabilities
killerbee.dev_telosb.TELOSB.__set_capabilities
killerbee.dev_wislab.WISLAB.__set_capabilities
killerbee.dev_zigduino.ZIGDUINO.__set_capabilities" class="py-name" href="#" onclick="return doclink('link-22', '__set_capabilities', 'link-22');">__set_capabilities</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">         </tt>
<a name="WISLAB.close"></a><div id="WISLAB.close-def"><a name="L115"></a><tt class="py-lineno">115</tt> <a class="py-toggle" href="#" id="WISLAB.close-toggle" onclick="return toggle('WISLAB.close');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#close">close</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.close-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.close-expanded"><a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-docstring">'''Actually close the receiving UDP socket.'''</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name" targets="Method killerbee.KillerBee.sniffer_off()=killerbee.KillerBee-class.html#sniffer_off,Method killerbee.dev_apimote.APIMOTE.sniffer_off()=killerbee.dev_apimote.APIMOTE-class.html#sniffer_off,Method killerbee.dev_freakduino.FREAKDUINO.sniffer_off()=killerbee.dev_freakduino.FREAKDUINO-class.html#sniffer_off,Method killerbee.dev_rzusbstick.RZUSBSTICK.sniffer_off()=killerbee.dev_rzusbstick.RZUSBSTICK-class.html#sniffer_off,Method killerbee.dev_telosb.TELOSB.sniffer_off()=killerbee.dev_telosb.TELOSB-class.html#sniffer_off,Method killerbee.dev_wislab.WISLAB.sniffer_off()=killerbee.dev_wislab.WISLAB-class.html#sniffer_off,Method killerbee.dev_zigduino.ZIGDUINO.sniffer_off()=killerbee.dev_zigduino.ZIGDUINO-class.html#sniffer_off"><a title="killerbee.KillerBee.sniffer_off
killerbee.dev_apimote.APIMOTE.sniffer_off
killerbee.dev_freakduino.FREAKDUINO.sniffer_off
killerbee.dev_rzusbstick.RZUSBSTICK.sniffer_off
killerbee.dev_telosb.TELOSB.sniffer_off
killerbee.dev_wislab.WISLAB.sniffer_off
killerbee.dev_zigduino.ZIGDUINO.sniffer_off" class="py-name" href="#" onclick="return doclink('link-23', 'sniffer_off', 'link-23');">sniffer_off</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt>  <tt class="py-comment"># turn sniffer off if it's currently running</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method killerbee.KillerBee.close()=killerbee.KillerBee-class.html#close,Method killerbee.daintree.DainTreeDumper.close()=killerbee.daintree.DainTreeDumper-class.html#close,Method killerbee.daintree.DainTreeReader.close()=killerbee.daintree.DainTreeReader-class.html#close,Method killerbee.dblog.DBLogger.close()=killerbee.dblog.DBLogger-class.html#close,Method killerbee.dblog.DBReader.close()=killerbee.dblog.DBReader-class.html#close,Method killerbee.dev_apimote.APIMOTE.close()=killerbee.dev_apimote.APIMOTE-class.html#close,Method killerbee.dev_freakduino.FREAKDUINO.close()=killerbee.dev_freakduino.FREAKDUINO-class.html#close,Method killerbee.dev_rzusbstick.RZUSBSTICK.close()=killerbee.dev_rzusbstick.RZUSBSTICK-class.html#close,Method killerbee.dev_telosb.TELOSB.close()=killerbee.dev_telosb.TELOSB-class.html#close,Method killerbee.dev_wislab.WISLAB.close()=killerbee.dev_wislab.WISLAB-class.html#close,Method killerbee.dev_zigduino.ZIGDUINO.close()=killerbee.dev_zigduino.ZIGDUINO-class.html#close,Method killerbee.openear.gps.client.gpscommon.close()=killerbee.openear.gps.client.gpscommon-class.html#close,Method killerbee.pcapdump.PcapDumper.close()=killerbee.pcapdump.PcapDumper-class.html#close,Method killerbee.pcapdump.PcapReader.close()=killerbee.pcapdump.PcapReader-class.html#close,Method killerbee.zbwardrive.db.ZBScanDB.close()=killerbee.zbwardrive.db.ZBScanDB-class.html#close,Method killerbee.zbwardrive.gps.client.gpscommon.close()=killerbee.zbwardrive.gps.client.gpscommon-class.html#close"><a title="killerbee.KillerBee.close
killerbee.daintree.DainTreeDumper.close
killerbee.daintree.DainTreeReader.close
killerbee.dblog.DBLogger.close
killerbee.dblog.DBReader.close
killerbee.dev_apimote.APIMOTE.close
killerbee.dev_freakduino.FREAKDUINO.close
killerbee.dev_rzusbstick.RZUSBSTICK.close
killerbee.dev_telosb.TELOSB.close
killerbee.dev_wislab.WISLAB.close
killerbee.dev_zigduino.ZIGDUINO.close
killerbee.openear.gps.client.gpscommon.close
killerbee.pcapdump.PcapDumper.close
killerbee.pcapdump.PcapReader.close
killerbee.zbwardrive.db.ZBScanDB.close
killerbee.zbwardrive.gps.client.gpscommon.close" class="py-name" href="#" onclick="return doclink('link-24', 'close', 'link-24');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment"># socket.close()</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.check_capability"></a><div id="WISLAB.check_capability-def"><a name="L121"></a><tt class="py-lineno">121</tt> <a class="py-toggle" href="#" id="WISLAB.check_capability-toggle" onclick="return toggle('WISLAB.check_capability');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#check_capability">check_capability</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">capab</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.check_capability-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.check_capability-expanded"><a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Method killerbee.kbutils.KBCapabilities.check()=killerbee.kbutils.KBCapabilities-class.html#check"><a title="killerbee.kbutils.KBCapabilities.check" class="py-name" href="#" onclick="return doclink('link-25', 'check', 'link-25');">check</a></tt><tt class="py-op">(</tt><tt class="py-name">capab</tt><tt class="py-op">)</tt> </tt>
</div><a name="WISLAB.get_capabilities"></a><div id="WISLAB.get_capabilities-def"><a name="L123"></a><tt class="py-lineno">123</tt> <a class="py-toggle" href="#" id="WISLAB.get_capabilities-toggle" onclick="return toggle('WISLAB.get_capabilities');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#get_capabilities">get_capabilities</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.get_capabilities-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.get_capabilities-expanded"><a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name" targets="Method killerbee.kbutils.KBCapabilities.getlist()=killerbee.kbutils.KBCapabilities-class.html#getlist"><a title="killerbee.kbutils.KBCapabilities.getlist" class="py-name" href="#" onclick="return doclink('link-26', 'getlist', 'link-26');">getlist</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="WISLAB.__set_capabilities"></a><div id="WISLAB.__set_capabilities-def"><a name="L125"></a><tt class="py-lineno">125</tt> <a class="py-toggle" href="#" id="WISLAB.__set_capabilities-toggle" onclick="return toggle('WISLAB.__set_capabilities');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__set_capabilities">__set_capabilities</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__set_capabilities-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__set_capabilities-expanded"><a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"><tt class="py-docstring">        Sets the capability information appropriate for the client and firmware version.</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"><tt class="py-docstring">        @return: None</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Method killerbee.kbutils.KBCapabilities.setcapab()=killerbee.kbutils.KBCapabilities-class.html#setcapab"><a title="killerbee.kbutils.KBCapabilities.setcapab" class="py-name" href="#" onclick="return doclink('link-27', 'setcapab', 'link-27');">setcapab</a></tt><tt class="py-op">(</tt><tt id="link-28" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-28', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.SNIFF=killerbee.kbutils.KBCapabilities-class.html#SNIFF"><a title="killerbee.kbutils.KBCapabilities.SNIFF" class="py-name" href="#" onclick="return doclink('link-29', 'SNIFF', 'link-29');">SNIFF</a></tt><tt class="py-op">,</tt> <tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="killerbee.kbutils.KBCapabilities.setcapab" class="py-name" href="#" onclick="return doclink('link-30', 'setcapab', 'link-27');">setcapab</a></tt><tt class="py-op">(</tt><tt id="link-31" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-31', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.SETCHAN=killerbee.kbutils.KBCapabilities-class.html#SETCHAN"><a title="killerbee.kbutils.KBCapabilities.SETCHAN" class="py-name" href="#" onclick="return doclink('link-32', 'SETCHAN', 'link-32');">SETCHAN</a></tt><tt class="py-op">,</tt> <tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="killerbee.kbutils.KBCapabilities.setcapab" class="py-name" href="#" onclick="return doclink('link-33', 'setcapab', 'link-27');">setcapab</a></tt><tt class="py-op">(</tt><tt id="link-34" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-34', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-35" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.FREQ_2400=killerbee.kbutils.KBCapabilities-class.html#FREQ_2400"><a title="killerbee.kbutils.KBCapabilities.FREQ_2400" class="py-name" href="#" onclick="return doclink('link-35', 'FREQ_2400', 'link-35');">FREQ_2400</a></tt><tt class="py-op">,</tt> <tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="killerbee.kbutils.KBCapabilities.setcapab" class="py-name" href="#" onclick="return doclink('link-36', 'setcapab', 'link-27');">setcapab</a></tt><tt class="py-op">(</tt><tt id="link-37" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-37', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-38" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.FREQ_900=killerbee.kbutils.KBCapabilities-class.html#FREQ_900"><a title="killerbee.kbutils.KBCapabilities.FREQ_900" class="py-name" href="#" onclick="return doclink('link-38', 'FREQ_900', 'link-38');">FREQ_900</a></tt><tt class="py-op">,</tt> <tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> </tt>
</div><a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line"> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.get_dev_info"></a><div id="WISLAB.get_dev_info-def"><a name="L138"></a><tt class="py-lineno">138</tt> <a class="py-toggle" href="#" id="WISLAB.get_dev_info-toggle" onclick="return toggle('WISLAB.get_dev_info');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#get_dev_info">get_dev_info</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.get_dev_info-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.get_dev_info-expanded"><a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">        Returns device information in a list identifying the device.</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: List</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">        @return: List of 3 strings identifying device.</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">,</tt> <tt class="py-string">"Wislab Sniffer v{0}"</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__revision_num</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-39" class="py-name" targets="Function killerbee.dev_wislab.getMacAddr()=killerbee.dev_wislab-module.html#getMacAddr"><a title="killerbee.dev_wislab.getMacAddr" class="py-name" href="#" onclick="return doclink('link-39', 'getMacAddr', 'link-39');">getMacAddr</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
</div><a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.__make_rest_call"></a><div id="WISLAB.__make_rest_call-def"><a name="L146"></a><tt class="py-lineno">146</tt> <a class="py-toggle" href="#" id="WISLAB.__make_rest_call-toggle" onclick="return toggle('WISLAB.__make_rest_call');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__make_rest_call">__make_rest_call</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">path</tt><tt class="py-op">,</tt> <tt class="py-param">fetch</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__make_rest_call-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__make_rest_call-expanded"><a name="L147"></a><tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line"><tt class="py-docstring">        Wrapper to the sniffer's RESTful services.</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">        Reports URL/HTTP errors as KBInterfaceErrors.</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: If fetch==True, returns a String of the page. Otherwise, it</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line"><tt class="py-docstring">            returns True if an HTTP 200 code was received.</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">            <tt class="py-name">html</tt> <tt class="py-op">=</tt> <tt class="py-name">urllib2</tt><tt class="py-op">.</tt><tt class="py-name">urlopen</tt><tt class="py-op">(</tt><tt class="py-string">"http://{0}/{1}"</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">fetch</tt><tt class="py-op">:</tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">html</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="killerbee.GoodFET.GoodFETbtser.read
killerbee.openear.gps.client.gpscommon.read
killerbee.zbwardrive.gps.client.gpscommon.read" class="py-name" href="#" onclick="return doclink('link-40', 'read', 'link-11');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">html</tt><tt class="py-op">.</tt><tt class="py-name">getcode</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">200</tt><tt class="py-op">)</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt> <tt class="py-keyword">as</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-41" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-41', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unable to preform a call to {0}/{1} (error: {2})."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">,</tt> <tt class="py-name">path</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.__sniffer_status"></a><div id="WISLAB.__sniffer_status-def"><a name="L162"></a><tt class="py-lineno">162</tt> <a class="py-toggle" href="#" id="WISLAB.__sniffer_status-toggle" onclick="return toggle('WISLAB.__sniffer_status');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__sniffer_status">__sniffer_status</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__sniffer_status-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__sniffer_status-expanded"><a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line"><tt class="py-docstring">        Because the firmware accepts only toggle commands for sniffer on/off,</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line"><tt class="py-docstring">        we need to check what state it's in before taking action. It's also</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line"><tt class="py-docstring">        useful to make sure our command worked.</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: Boolean</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">        <tt class="py-name">html</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Method killerbee.dev_wislab.WISLAB.__make_rest_call()=killerbee.dev_wislab.WISLAB-class.html#__make_rest_call"><a title="killerbee.dev_wislab.WISLAB.__make_rest_call" class="py-name" href="#" onclick="return doclink('link-42', '__make_rest_call', 'link-42');">__make_rest_call</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt class="py-comment"># Yup, we're going to have to steal the status out of a JavaScript variable</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">search</tt><tt class="py-op">(</tt><tt class="py-string">r'&lt;!--#pindex--&gt;([A-Z]+),'</tt><tt class="py-op">,</tt> <tt class="py-name">html</tt><tt class="py-op">)</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">res</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-43" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-43', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unable to parse the sniffer's current status."</tt><tt class="py-op">)</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">        <tt class="py-comment"># RUNNING means it's sniffing, STOPPED means it's not.</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-string">"RUNNING"</tt><tt class="py-op">)</tt> </tt>
</div><a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.__sync_status"></a><div id="WISLAB.__sync_status-def"><a name="L177"></a><tt class="py-lineno">177</tt> <a class="py-toggle" href="#" id="WISLAB.__sync_status-toggle" onclick="return toggle('WISLAB.__sync_status');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__sync_status">__sync_status</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__sync_status-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__sync_status-expanded"><a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line"><tt class="py-docstring">        This updates the standard self.__stream_open variable based on the </tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-docstring">        status as reported from asking the remote sniffer.</tt> </tt>
<a name="L181"></a><tt class="py-lineno">181</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name" targets="Method killerbee.dev_wislab.WISLAB.__sniffer_status()=killerbee.dev_wislab.WISLAB-class.html#__sniffer_status"><a title="killerbee.dev_wislab.WISLAB.__sniffer_status" class="py-name" href="#" onclick="return doclink('link-44', '__sniffer_status', 'link-44');">__sniffer_status</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.__sniffer_channel"></a><div id="WISLAB.__sniffer_channel-def"><a name="L184"></a><tt class="py-lineno">184</tt> <a class="py-toggle" href="#" id="WISLAB.__sniffer_channel-toggle" onclick="return toggle('WISLAB.__sniffer_channel');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__sniffer_channel">__sniffer_channel</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__sniffer_channel-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__sniffer_channel-expanded"><a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-docstring">        Because the firmware accepts only toggle commands for sniffer on/off,</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line"><tt class="py-docstring">        we need to check what state it's in before taking action. It's also</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line"><tt class="py-docstring">        useful to make sure our command worked.</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: Boolean</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">        <tt class="py-name">html</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__make_rest_call" class="py-name" href="#" onclick="return doclink('link-45', '__make_rest_call', 'link-42');">__make_rest_call</a></tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">        <tt class="py-comment"># Yup, we're going to have to steal the channel number out of a JavaScript variable</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">        <tt class="py-comment">#  var values = removeSSItag('&lt;!--#pindex--&gt;RUNNING,00:1a:b6:00:0a:a4,10.10.10.2,0,High,0x0000,OFF,0,0').split(",");</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">        <tt class="py-name">res</tt> <tt class="py-op">=</tt> <tt class="py-name">re</tt><tt class="py-op">.</tt><tt class="py-name">search</tt><tt class="py-op">(</tt><tt class="py-string">r'&lt;!--#pindex--&gt;[A-Z]+,[0-9a-f:]+,[0-9.]+,([0-9]+),'</tt><tt class="py-op">,</tt> <tt class="py-name">html</tt><tt class="py-op">)</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">res</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-46" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-46', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Unable to parse the sniffer's current channel."</tt><tt class="py-op">)</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">res</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line"> </tt>
<a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.sniffer_on"></a><div id="WISLAB.sniffer_on-def"><a name="L200"></a><tt class="py-lineno">200</tt> <a class="py-toggle" href="#" id="WISLAB.sniffer_on-toggle" onclick="return toggle('WISLAB.sniffer_on');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#sniffer_on">sniffer_on</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">channel</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.sniffer_on-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.sniffer_on-expanded"><a name="L201"></a><tt class="py-lineno">201</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line"><tt class="py-docstring">        Turns the sniffer on such that pnext() will start returning observed</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-docstring">        data.</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">        @type channel: Integer</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-docstring">        @param channel: Sets the channel, optional</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name" targets="Method killerbee.kbutils.KBCapabilities.require()=killerbee.kbutils.KBCapabilities-class.html#require"><a title="killerbee.kbutils.KBCapabilities.require" class="py-name" href="#" onclick="return doclink('link-47', 'require', 'link-47');">require</a></tt><tt class="py-op">(</tt><tt id="link-48" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-48', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="killerbee.kbutils.KBCapabilities.SNIFF" class="py-name" href="#" onclick="return doclink('link-49', 'SNIFF', 'link-29');">SNIFF</a></tt><tt class="py-op">)</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line"> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">        <tt class="py-comment"># Because the Wislab just toggles, we have to only hit the page </tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">        <tt class="py-comment"># if we need to go from off to on state.</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name" targets="Method killerbee.dev_wislab.WISLAB.__sync_status()=killerbee.dev_wislab.WISLAB-class.html#__sync_status"><a title="killerbee.dev_wislab.WISLAB.__sync_status" class="py-name" href="#" onclick="return doclink('link-50', '__sync_status', 'link-50');">__sync_status</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt> <tt class="py-op">==</tt> <tt class="py-name">False</tt><tt class="py-op">:</tt> </tt>
<a name="L214"></a><tt class="py-lineno">214</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-51" class="py-name" targets="Variable killerbee.KillerBee.channel=killerbee.KillerBee-class.html#channel"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-51', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">!=</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name" targets="Method killerbee.KillerBee.set_channel()=killerbee.KillerBee-class.html#set_channel,Method killerbee.dblog.DBLogger.set_channel()=killerbee.dblog.DBLogger-class.html#set_channel,Method killerbee.dev_apimote.APIMOTE.set_channel()=killerbee.dev_apimote.APIMOTE-class.html#set_channel,Method killerbee.dev_freakduino.FREAKDUINO.set_channel()=killerbee.dev_freakduino.FREAKDUINO-class.html#set_channel,Method killerbee.dev_rzusbstick.RZUSBSTICK.set_channel()=killerbee.dev_rzusbstick.RZUSBSTICK-class.html#set_channel,Method killerbee.dev_telosb.TELOSB.set_channel()=killerbee.dev_telosb.TELOSB-class.html#set_channel,Method killerbee.dev_wislab.WISLAB.set_channel()=killerbee.dev_wislab.WISLAB-class.html#set_channel,Method killerbee.dev_zigduino.ZIGDUINO.set_channel()=killerbee.dev_zigduino.ZIGDUINO-class.html#set_channel"><a title="killerbee.KillerBee.set_channel
killerbee.dblog.DBLogger.set_channel
killerbee.dev_apimote.APIMOTE.set_channel
killerbee.dev_freakduino.FREAKDUINO.set_channel
killerbee.dev_rzusbstick.RZUSBSTICK.set_channel
killerbee.dev_telosb.TELOSB.set_channel
killerbee.dev_wislab.WISLAB.set_channel
killerbee.dev_zigduino.ZIGDUINO.set_channel" class="py-name" href="#" onclick="return doclink('link-52', 'set_channel', 'link-52');">set_channel</a></tt><tt class="py-op">(</tt><tt id="link-53" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-53', 'channel', 'link-51');">channel</a></tt><tt class="py-op">)</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">             </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__make_rest_call" class="py-name" href="#" onclick="return doclink('link-54', '__make_rest_call', 'link-42');">__make_rest_call</a></tt><tt class="py-op">(</tt><tt class="py-string">'status.cgi?p=2'</tt><tt class="py-op">,</tt> <tt class="py-name">fetch</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-55" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-55', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Error instructing sniffer to start capture."</tt><tt class="py-op">)</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line"> </tt>
<a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line">            <tt class="py-comment">#This makes sure the change actually happened</tt> </tt>
<a name="L221"></a><tt class="py-lineno">221</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__sync_status" class="py-name" href="#" onclick="return doclink('link-56', '__sync_status', 'link-50');">__sync_status</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt><tt class="py-op">:</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-57" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-57', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Sniffer did not turn on capture."</tt><tt class="py-op">)</tt> </tt>
</div><a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line">                 </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.sniffer_off"></a><div id="WISLAB.sniffer_off-def"><a name="L226"></a><tt class="py-lineno">226</tt> <a class="py-toggle" href="#" id="WISLAB.sniffer_off-toggle" onclick="return toggle('WISLAB.sniffer_off');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#sniffer_off">sniffer_off</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.sniffer_off-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.sniffer_off-expanded"><a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line"><tt class="py-docstring">        Turns the sniffer off.</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">        <tt class="py-comment"># Because the Wislab just toggles, we have to only hit the page </tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line">        <tt class="py-comment"># if we need to go from on to off state.</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__sync_status" class="py-name" href="#" onclick="return doclink('link-58', '__sync_status', 'link-50');">__sync_status</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt> <tt class="py-op">==</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__make_rest_call" class="py-name" href="#" onclick="return doclink('link-59', '__make_rest_call', 'link-42');">__make_rest_call</a></tt><tt class="py-op">(</tt><tt class="py-string">'status.cgi?p=2'</tt><tt class="py-op">,</tt> <tt class="py-name">fetch</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-60" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-60', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Error instructing sniffer to stop capture."</tt><tt class="py-op">)</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line">             </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line">            <tt class="py-comment">#This makes sure the change actually happened</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__sync_status" class="py-name" href="#" onclick="return doclink('link-61', '__sync_status', 'link-50');">__sync_status</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt><tt class="py-op">:</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt id="link-62" class="py-name"><a title="killerbee.kbutils.KBInterfaceError" class="py-name" href="#" onclick="return doclink('link-62', 'KBInterfaceError', 'link-5');">KBInterfaceError</a></tt><tt class="py-op">(</tt><tt class="py-string">"Sniffer did not turn off capture."</tt><tt class="py-op">)</tt> </tt>
</div><a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">     </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">    <tt class="py-decorator">@</tt><tt class="py-decorator">staticmethod</tt> </tt>
<a name="WISLAB.__get_default_modulation"></a><div id="WISLAB.__get_default_modulation-def"><a name="L244"></a><tt class="py-lineno">244</tt> <a class="py-toggle" href="#" id="WISLAB.__get_default_modulation-toggle" onclick="return toggle('WISLAB.__get_default_modulation');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__get_default_modulation">__get_default_modulation</a><tt class="py-op">(</tt><tt class="py-param">channel</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__get_default_modulation-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__get_default_modulation-expanded"><a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line"><tt class="py-docstring">        Return the Wislab-specific integer representing the modulation which</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line"><tt class="py-docstring">        should be choosen to be IEEE 802.15.4 complinating for a given channel </tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line"><tt class="py-docstring">        number.</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line"><tt class="py-docstring">        Captured values from sniffing Wislab web interface, unsure why these</tt> </tt>
<a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line"><tt class="py-docstring">        are done as such.</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line"><tt class="py-docstring">        Available modulations are listed at:</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line"><tt class="py-docstring">        http://www.sewio.net/open-sniffer/develop/http-rest-interface/</tt> </tt>
<a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: Integer, or None if unable to determine modulation</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-63" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-63', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">11</tt> <tt class="py-keyword">or</tt> <tt id="link-64" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-64', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">26</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-string">'0'</tt>   <tt class="py-comment">#O-QPSK 250 kb/s 2.4GHz</tt> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt id="link-65" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-65', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">1</tt> <tt class="py-keyword">or</tt> <tt id="link-66" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-66', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">10</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-string">'c'</tt>  <tt class="py-comment">#O-QPSK 250 kb/s 915MHz</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt id="link-67" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-67', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">128</tt> <tt class="py-keyword">or</tt> <tt id="link-68" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-68', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">&lt;=</tt> <tt class="py-number">131</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-string">'1c'</tt> <tt class="py-comment">#O-QPSK 250 kb/s 760MHz</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt id="link-69" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-69', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-string">'0'</tt>                   <tt class="py-comment">#O-QPSK 100 kb/s 868MHz</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">None</tt>                               <tt class="py-comment">#Error status</tt> </tt>
</div><a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line"> </tt>
<a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.set_channel"></a><div id="WISLAB.set_channel-def"><a name="L262"></a><tt class="py-lineno">262</tt> <a class="py-toggle" href="#" id="WISLAB.set_channel-toggle" onclick="return toggle('WISLAB.set_channel');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#set_channel">set_channel</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">channel</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.set_channel-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.set_channel-expanded"><a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line"><tt class="py-docstring">        Sets the radio interface to the specifid channel (limited to 2.4 GHz channels 11-26)</tt> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line"><tt class="py-docstring">        @type channel: Integer</tt> </tt>
<a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line"><tt class="py-docstring">        @param channel: Sets the channel, optional</tt> </tt>
<a name="L267"></a><tt class="py-lineno">267</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="killerbee.kbutils.KBCapabilities.require" class="py-name" href="#" onclick="return doclink('link-70', 'require', 'link-47');">require</a></tt><tt class="py-op">(</tt><tt id="link-71" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-71', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="killerbee.kbutils.KBCapabilities.SETCHAN" class="py-name" href="#" onclick="return doclink('link-72', 'SETCHAN', 'link-32');">SETCHAN</a></tt><tt class="py-op">)</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line"> </tt>
<a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Method killerbee.KillerBee.is_valid_channel()=killerbee.KillerBee-class.html#is_valid_channel,Method killerbee.kbutils.KBCapabilities.is_valid_channel()=killerbee.kbutils.KBCapabilities-class.html#is_valid_channel"><a title="killerbee.KillerBee.is_valid_channel
killerbee.kbutils.KBCapabilities.is_valid_channel" class="py-name" href="#" onclick="return doclink('link-73', 'is_valid_channel', 'link-73');">is_valid_channel</a></tt><tt class="py-op">(</tt><tt id="link-74" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-74', 'channel', 'link-51');">channel</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L272"></a><tt class="py-lineno">272</tt>  <tt class="py-line">            <tt class="py-comment"># We only need to update our channel if it doesn't match the currently reported one.</tt> </tt>
<a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">            <tt class="py-name">curChannel</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name" targets="Method killerbee.dev_wislab.WISLAB.__sniffer_channel()=killerbee.dev_wislab.WISLAB-class.html#__sniffer_channel"><a title="killerbee.dev_wislab.WISLAB.__sniffer_channel" class="py-name" href="#" onclick="return doclink('link-75', '__sniffer_channel', 'link-75');">__sniffer_channel</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L274"></a><tt class="py-lineno">274</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-76" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-76', 'channel', 'link-51');">channel</a></tt> <tt class="py-op">!=</tt> <tt class="py-name">curChannel</tt><tt class="py-op">:</tt> </tt>
<a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">modulation</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name" targets="Static Method killerbee.dev_wislab.WISLAB.__get_default_modulation()=killerbee.dev_wislab.WISLAB-class.html#__get_default_modulation"><a title="killerbee.dev_wislab.WISLAB.__get_default_modulation" class="py-name" href="#" onclick="return doclink('link-77', '__get_default_modulation', 'link-77');">__get_default_modulation</a></tt><tt class="py-op">(</tt><tt id="link-78" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-78', 'channel', 'link-51');">channel</a></tt><tt class="py-op">)</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line">                <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"Setting to channel {0}, modulation {1}."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt id="link-79" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-79', 'channel', 'link-51');">channel</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">modulation</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line">                <tt class="py-comment"># Examples captured in fw v0.5 sniffing:</tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">                <tt class="py-comment">#   channel 6, 250 compliant: http://10.10.10.2/settings.cgi?chn=6&amp;modul=c&amp;rxsens=0</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">                <tt class="py-comment">#   channel 12, 250 compliant: http://10.10.10.2/settings.cgi?chn=12&amp;modul=0&amp;rxsens=0</tt> </tt>
<a name="L280"></a><tt class="py-lineno">280</tt>  <tt class="py-line">                <tt class="py-comment">#   chinese 0, 780 MHz, 250 compliant: http://10.10.10.2/settings.cgi?chn=128&amp;modul=1c&amp;rxsens=0</tt> </tt>
<a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">                <tt class="py-comment">#   chinese 3, 786 MHz, 250 compliant: http://10.10.10.2/settings.cgi?chn=131&amp;modul=1c&amp;rxsens=0</tt> </tt>
<a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__make_rest_call" class="py-name" href="#" onclick="return doclink('link-80', '__make_rest_call', 'link-42');">__make_rest_call</a></tt><tt class="py-op">(</tt><tt class="py-string">"settings.cgi?chn={0}&amp;modul={1}&amp;rxsens=0"</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt id="link-81" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-81', 'channel', 'link-51');">channel</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">modulation</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">fetch</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
<a name="L283"></a><tt class="py-lineno">283</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_channel</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-82" class="py-name"><a title="killerbee.dev_wislab.WISLAB.__sniffer_channel" class="py-name" href="#" onclick="return doclink('link-82', '__sniffer_channel', 'link-75');">__sniffer_channel</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_channel</tt> <tt class="py-op">=</tt> <tt class="py-name">curChannel</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">Exception</tt><tt class="py-op">(</tt><tt class="py-string">'Invalid channel number ({0}) was provided'</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt id="link-83" class="py-name"><a title="killerbee.KillerBee.channel" class="py-name" href="#" onclick="return doclink('link-83', 'channel', 'link-51');">channel</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L288"></a><tt class="py-lineno">288</tt>  <tt class="py-line"> </tt>
<a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.inject"></a><div id="WISLAB.inject-def"><a name="L290"></a><tt class="py-lineno">290</tt> <a class="py-toggle" href="#" id="WISLAB.inject-toggle" onclick="return toggle('WISLAB.inject');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#inject">inject</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">packet</tt><tt class="py-op">,</tt> <tt class="py-param">channel</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">count</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-param">delay</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.inject-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.inject-expanded"><a name="L291"></a><tt class="py-lineno">291</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L292"></a><tt class="py-lineno">292</tt>  <tt class="py-line"><tt class="py-docstring">        Not implemented.</tt> </tt>
<a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name"><a title="killerbee.kbutils.KBCapabilities.require" class="py-name" href="#" onclick="return doclink('link-84', 'require', 'link-47');">require</a></tt><tt class="py-op">(</tt><tt id="link-85" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-85', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-86" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.INJECT=killerbee.kbutils.KBCapabilities-class.html#INJECT"><a title="killerbee.kbutils.KBCapabilities.INJECT" class="py-name" href="#" onclick="return doclink('link-86', 'INJECT', 'link-86');">INJECT</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L295"></a><tt class="py-lineno">295</tt>  <tt class="py-line"> </tt>
<a name="L296"></a><tt class="py-lineno">296</tt>  <tt class="py-line">    <tt class="py-decorator">@</tt><tt class="py-decorator">staticmethod</tt> </tt>
<a name="WISLAB.__parse_zep_v2"></a><div id="WISLAB.__parse_zep_v2-def"><a name="L297"></a><tt class="py-lineno">297</tt> <a class="py-toggle" href="#" id="WISLAB.__parse_zep_v2-toggle" onclick="return toggle('WISLAB.__parse_zep_v2');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#__parse_zep_v2">__parse_zep_v2</a><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.__parse_zep_v2-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.__parse_zep_v2-expanded"><a name="L298"></a><tt class="py-lineno">298</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L299"></a><tt class="py-lineno">299</tt>  <tt class="py-line"><tt class="py-docstring">        Parse the packet from the ZigBee encapsulation protocol version 2/3 and </tt> </tt>
<a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line"><tt class="py-docstring">        return the fields desired for usage by pnext().</tt> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line"><tt class="py-docstring">        There is support here for some oddities specific to the Wislab </tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line"><tt class="py-docstring">        implementation of ZEP and the packet, such as CC24xx format FCS </tt> </tt>
<a name="L303"></a><tt class="py-lineno">303</tt>  <tt class="py-line"><tt class="py-docstring">        headers being expected.</tt> </tt>
<a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line"><tt class="py-docstring">        The ZEP protocol parsing is mainly based on Wireshark source at:</tt> </tt>
<a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line"><tt class="py-docstring">        http://anonsvn.wireshark.org/wireshark/trunk/epan/dissectors/packet-zep.c</tt> </tt>
<a name="L307"></a><tt class="py-lineno">307</tt>  <tt class="py-line"><tt class="py-docstring">        * ZEP v2 Header will have the following format (if type=1/Data):</tt> </tt>
<a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line"><tt class="py-docstring">        *  |Preamble|Version| Type |Channel ID|Device ID|CRC/LQI Mode|LQI Val|NTP Timestamp|Sequence#|Reserved|Length|</tt> </tt>
<a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line"><tt class="py-docstring">        *  |2 bytes |1 byte |1 byte|  1 byte  | 2 bytes |   1 byte   |1 byte |   8 bytes   | 4 bytes |10 bytes|1 byte|</tt> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line"><tt class="py-docstring">        * ZEP v2 Header will have the following format (if type=2/Ack):</tt> </tt>
<a name="L311"></a><tt class="py-lineno">311</tt>  <tt class="py-line"><tt class="py-docstring">        *  |Preamble|Version| Type |Sequence#|</tt> </tt>
<a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line"><tt class="py-docstring">        *  |2 bytes |1 byte |1 byte| 4 bytes |</tt> </tt>
<a name="L313"></a><tt class="py-lineno">313</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_PREAMBLE        "EX"</tt> </tt>
<a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_V2_HEADER_LEN   32</tt> </tt>
<a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_V2_ACK_LEN      8</tt> </tt>
<a name="L316"></a><tt class="py-lineno">316</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_V2_TYPE_DATA    1</tt> </tt>
<a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_V2_TYPE_ACK     2</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line"><tt class="py-docstring">        #define ZEP_LENGTH_MASK     0x7F</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L320"></a><tt class="py-lineno">320</tt>  <tt class="py-line">        <tt class="py-comment"># Unpack constant part of ZEPv2</tt> </tt>
<a name="L321"></a><tt class="py-lineno">321</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-name">preamble</tt><tt class="py-op">,</tt> <tt class="py-name">version</tt><tt class="py-op">,</tt> <tt class="py-name">zeptype</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'&lt;HBB'</tt><tt class="py-op">,</tt> <tt id="link-87" class="py-name" targets="Variable killerbee.GoodFET.GoodFET.data=killerbee.GoodFET.GoodFET-class.html#data"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-87', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">preamble</tt> <tt class="py-op">!=</tt> <tt class="py-number">22597</tt> <tt class="py-keyword">or</tt> <tt class="py-name">version</tt> <tt class="py-op">&lt;</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> <tt class="py-comment"># 'EX'==22597, and v3 is compat with v2 (I think??)</tt> </tt>
<a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">Exception</tt><tt class="py-op">(</tt><tt class="py-string">"Can not parse provided data as ZEP due to incorrect preamble or unsupported version."</tt><tt class="py-op">)</tt> </tt>
<a name="L324"></a><tt class="py-lineno">324</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">zeptype</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> <tt class="py-comment">#data</tt> </tt>
<a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">ch</tt><tt class="py-op">,</tt> <tt class="py-name">devid</tt><tt class="py-op">,</tt> <tt class="py-name">crcmode</tt><tt class="py-op">,</tt> <tt class="py-name">lqival</tt><tt class="py-op">,</tt> <tt class="py-name">ntpsec</tt><tt class="py-op">,</tt> <tt class="py-name">ntpnsec</tt><tt class="py-op">,</tt> <tt class="py-name">seqnum</tt><tt class="py-op">,</tt> <tt class="py-name">length</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">"&gt;BHBBIII10xB"</tt><tt class="py-op">,</tt> <tt id="link-88" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-88', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-number">32</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L326"></a><tt class="py-lineno">326</tt>  <tt class="py-line">            <tt class="py-comment">#print "Data ZEP:", ch, devid, crcmode, lqival, ntpsec, ntpnsec, seqnum, length</tt> </tt>
<a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line">            <tt class="py-comment">#We could convert the NTP timestamp received to system time, but the</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line">            <tt class="py-comment"># Wislab firmware uses "relative timestamping" where it begins at 0 each time</tt> </tt>
<a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line">            <tt class="py-comment"># the sniffer is started. Thus, it isn't that useful to us, so we just add the</tt> </tt>
<a name="L330"></a><tt class="py-lineno">330</tt>  <tt class="py-line">            <tt class="py-comment"># time the packet is received at the host instead.</tt> </tt>
<a name="L331"></a><tt class="py-lineno">331</tt>  <tt class="py-line">            <tt class="py-comment">#print "\tConverted time:", ntp_to_system_time(ntpsec, ntpnsec)</tt> </tt>
<a name="L332"></a><tt class="py-lineno">332</tt>  <tt class="py-line">            <tt class="py-name">recdtime</tt> <tt class="py-op">=</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">combine</tt><tt class="py-op">(</tt><tt class="py-name">date</tt><tt class="py-op">.</tt><tt class="py-name">today</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">time</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-comment">#TODO address timezones by going to UTC everywhere</tt> </tt>
<a name="L333"></a><tt class="py-lineno">333</tt>  <tt class="py-line">            <tt class="py-comment">#The LQI comes in ZEP, but the RSSI comes in the first byte of the FCS,</tt> </tt>
<a name="L334"></a><tt class="py-lineno">334</tt>  <tt class="py-line">            <tt class="py-comment"># if the FCS was correct. If the byte is 0xb1, Wireshark appears to do 0xb1-256 = -79 dBm.</tt> </tt>
<a name="L335"></a><tt class="py-lineno">335</tt>  <tt class="py-line">            <tt class="py-comment"># It appears that if CRC/LQI Mode field == 1, then checksum was bad, so the RSSI isn't</tt> </tt>
<a name="L336"></a><tt class="py-lineno">336</tt>  <tt class="py-line">            <tt class="py-comment"># available, as the CRC is left in the packet. If it == 0, then the first byte of FCS is the RSSI.</tt> </tt>
<a name="L337"></a><tt class="py-lineno">337</tt>  <tt class="py-line">            <tt class="py-comment"># From Wireshark:</tt> </tt>
<a name="L338"></a><tt class="py-lineno">338</tt>  <tt class="py-line">            <tt class="py-comment">#define IEEE802154_CC24xx_CRC_OK            0x8000</tt> </tt>
<a name="L339"></a><tt class="py-lineno">339</tt>  <tt class="py-line">            <tt class="py-comment">#define IEEE802154_CC24xx_RSSI              0x00FF</tt> </tt>
<a name="L340"></a><tt class="py-lineno">340</tt>  <tt class="py-line">            <tt class="py-name">frame</tt> <tt class="py-op">=</tt> <tt id="link-89" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-89', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-number">32</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L341"></a><tt class="py-lineno">341</tt>  <tt class="py-line">            <tt class="py-comment"># A length vs len(frame) check is not used here but is an </tt> </tt>
<a name="L342"></a><tt class="py-lineno">342</tt>  <tt class="py-line">            <tt class="py-comment">#  additional way to verify that all is good (length == len(frame)).</tt> </tt>
<a name="L343"></a><tt class="py-lineno">343</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">crcmode</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L344"></a><tt class="py-lineno">344</tt>  <tt class="py-line">                <tt class="py-name">validcrc</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ord</tt><tt class="py-op">(</tt><tt id="link-90" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-90', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> <tt class="py-op">&amp;</tt> <tt class="py-number">0x80</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0x80</tt><tt class="py-op">)</tt> </tt>
<a name="L345"></a><tt class="py-lineno">345</tt>  <tt class="py-line">                <tt class="py-name">rssi</tt> <tt class="py-op">=</tt> <tt class="py-name">ord</tt><tt class="py-op">(</tt><tt id="link-91" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-91', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L346"></a><tt class="py-lineno">346</tt>  <tt class="py-line">                <tt class="py-comment"># We have to trust the sniffer that the FCS was OK, so we compute</tt> </tt>
<a name="L347"></a><tt class="py-lineno">347</tt>  <tt class="py-line">                <tt class="py-comment">#  what a good FCS should be and patch it back into the packet.</tt> </tt>
<a name="L348"></a><tt class="py-lineno">348</tt>  <tt class="py-line">                <tt class="py-name">frame</tt> <tt class="py-op">=</tt> <tt class="py-name">frame</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">+</tt> <tt id="link-92" class="py-name"><a title="killerbee.kbutils.makeFCS" class="py-name" href="#" onclick="return doclink('link-92', 'makeFCS', 'link-3');">makeFCS</a></tt><tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L349"></a><tt class="py-lineno">349</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt>  <tt class="py-line">                <tt class="py-name">validcrc</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L351"></a><tt class="py-lineno">351</tt>  <tt class="py-line">                <tt class="py-name">rssi</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L352"></a><tt class="py-lineno">352</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">,</tt> <tt class="py-name">ch</tt><tt class="py-op">,</tt> <tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-name">rssi</tt><tt class="py-op">,</tt> <tt class="py-name">lqival</tt><tt class="py-op">,</tt> <tt class="py-name">recdtime</tt><tt class="py-op">)</tt> </tt>
<a name="L353"></a><tt class="py-lineno">353</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">zeptype</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> <tt class="py-comment">#ack</tt> </tt>
<a name="L354"></a><tt class="py-lineno">354</tt>  <tt class="py-line">            <tt class="py-name">frame</tt> <tt class="py-op">=</tt> <tt id="link-93" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-93', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L355"></a><tt class="py-lineno">355</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">seqnum</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">"&gt;I"</tt><tt class="py-op">,</tt> <tt id="link-94" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-94', 'data', 'link-87');">data</a></tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-number">8</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L356"></a><tt class="py-lineno">356</tt>  <tt class="py-line">            <tt class="py-name">recdtime</tt> <tt class="py-op">=</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">combine</tt><tt class="py-op">(</tt><tt class="py-name">date</tt><tt class="py-op">.</tt><tt class="py-name">today</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">time</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> <tt class="py-comment">#TODO address timezones by going to UTC everywhere</tt> </tt>
<a name="L357"></a><tt class="py-lineno">357</tt>  <tt class="py-line">            <tt class="py-name">validcrc</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt id="link-95" class="py-name"><a title="killerbee.kbutils.makeFCS" class="py-name" href="#" onclick="return doclink('link-95', 'makeFCS', 'link-3');">makeFCS</a></tt><tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L358"></a><tt class="py-lineno">358</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">recdtime</tt><tt class="py-op">)</tt> </tt>
<a name="L359"></a><tt class="py-lineno">359</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
</div><a name="L360"></a><tt class="py-lineno">360</tt>  <tt class="py-line"> </tt>
<a name="L361"></a><tt class="py-lineno">361</tt>  <tt class="py-line">    <tt class="py-comment"># KillerBee expects the driver to implement this function</tt> </tt>
<a name="WISLAB.pnext"></a><div id="WISLAB.pnext-def"><a name="L362"></a><tt class="py-lineno">362</tt> <a class="py-toggle" href="#" id="WISLAB.pnext-toggle" onclick="return toggle('WISLAB.pnext');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#pnext">pnext</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">timeout</tt><tt class="py-op">=</tt><tt class="py-number">100</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.pnext-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.pnext-expanded"><a name="L363"></a><tt class="py-lineno">363</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L364"></a><tt class="py-lineno">364</tt>  <tt class="py-line"><tt class="py-docstring">        Returns a dictionary containing packet data, else None.</tt> </tt>
<a name="L365"></a><tt class="py-lineno">365</tt>  <tt class="py-line"><tt class="py-docstring">        @type timeout: Integer</tt> </tt>
<a name="L366"></a><tt class="py-lineno">366</tt>  <tt class="py-line"><tt class="py-docstring">        @param timeout: Timeout to wait for packet reception in usec</tt> </tt>
<a name="L367"></a><tt class="py-lineno">367</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: List</tt> </tt>
<a name="L368"></a><tt class="py-lineno">368</tt>  <tt class="py-line"><tt class="py-docstring">        @return: Returns None is timeout expires and no packet received.  When a packet is received, a dictionary is returned with the keys bytes (string of packet bytes), validcrc (boolean if a vaid CRC), rssi (unscaled RSSI), and location (may be set to None). For backwards compatibility, keys for 0,1,2 are provided such that it can be treated as if a list is returned, in the form [ String: packet contents | Bool: Valid CRC | Int: Unscaled RSSI ]</tt> </tt>
<a name="L369"></a><tt class="py-lineno">369</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L370"></a><tt class="py-lineno">370</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__stream_open</tt> <tt class="py-op">==</tt> <tt class="py-name">False</tt><tt class="py-op">:</tt> </tt>
<a name="L371"></a><tt class="py-lineno">371</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method killerbee.KillerBee.sniffer_on()=killerbee.KillerBee-class.html#sniffer_on,Method killerbee.dev_apimote.APIMOTE.sniffer_on()=killerbee.dev_apimote.APIMOTE-class.html#sniffer_on,Method killerbee.dev_freakduino.FREAKDUINO.sniffer_on()=killerbee.dev_freakduino.FREAKDUINO-class.html#sniffer_on,Method killerbee.dev_rzusbstick.RZUSBSTICK.sniffer_on()=killerbee.dev_rzusbstick.RZUSBSTICK-class.html#sniffer_on,Method killerbee.dev_telosb.TELOSB.sniffer_on()=killerbee.dev_telosb.TELOSB-class.html#sniffer_on,Method killerbee.dev_wislab.WISLAB.sniffer_on()=killerbee.dev_wislab.WISLAB-class.html#sniffer_on,Method killerbee.dev_zigduino.ZIGDUINO.sniffer_on()=killerbee.dev_zigduino.ZIGDUINO-class.html#sniffer_on"><a title="killerbee.KillerBee.sniffer_on
killerbee.dev_apimote.APIMOTE.sniffer_on
killerbee.dev_freakduino.FREAKDUINO.sniffer_on
killerbee.dev_rzusbstick.RZUSBSTICK.sniffer_on
killerbee.dev_telosb.TELOSB.sniffer_on
killerbee.dev_wislab.WISLAB.sniffer_on
killerbee.dev_zigduino.ZIGDUINO.sniffer_on" class="py-name" href="#" onclick="return doclink('link-96', 'sniffer_on', 'link-96');">sniffer_on</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-comment">#start sniffing</tt> </tt>
<a name="L372"></a><tt class="py-lineno">372</tt>  <tt class="py-line"> </tt>
<a name="L373"></a><tt class="py-lineno">373</tt>  <tt class="py-line">        <tt class="py-comment"># Use socket timeouts to implement the timeout</tt> </tt>
<a name="L374"></a><tt class="py-lineno">374</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">.</tt><tt class="py-name">settimeout</tt><tt class="py-op">(</tt><tt id="link-97" class="py-name"><a title="killerbee.GoodFET.GoodFET.timeout" class="py-name" href="#" onclick="return doclink('link-97', 'timeout', 'link-0');">timeout</a></tt> <tt class="py-op">/</tt> <tt class="py-number">1000000.0</tt><tt class="py-op">)</tt> <tt class="py-comment"># it takes seconds</tt> </tt>
<a name="L375"></a><tt class="py-lineno">375</tt>  <tt class="py-line"> </tt>
<a name="L376"></a><tt class="py-lineno">376</tt>  <tt class="py-line">        <tt class="py-name">frame</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L377"></a><tt class="py-lineno">377</tt>  <tt class="py-line">        <tt class="py-name">donetime</tt> <tt class="py-op">=</tt> <tt class="py-name">datetime</tt><tt class="py-op">.</tt><tt class="py-name">now</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">timedelta</tt><tt class="py-op">(</tt><tt class="py-name">microseconds</tt><tt class="py-op">=</tt><tt id="link-98" class="py-name"><a title="killerbee.GoodFET.GoodFET.timeout" class="py-name" href="#" onclick="return doclink('link-98', 'timeout', 'link-0');">timeout</a></tt><tt class="py-op">)</tt> </tt>
<a name="L378"></a><tt class="py-lineno">378</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
<a name="L379"></a><tt class="py-lineno">379</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L380"></a><tt class="py-lineno">380</tt>  <tt class="py-line">                <tt id="link-99" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-99', 'data', 'link-87');">data</a></tt><tt class="py-op">,</tt> <tt class="py-name">addr</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">handle</tt><tt class="py-op">.</tt><tt class="py-name">recvfrom</tt><tt class="py-op">(</tt><tt class="py-number">1024</tt><tt class="py-op">)</tt> </tt>
<a name="L381"></a><tt class="py-lineno">381</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">error_timeout</tt><tt class="py-op">:</tt> </tt>
<a name="L382"></a><tt class="py-lineno">382</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<a name="L383"></a><tt class="py-lineno">383</tt>  <tt class="py-line">            <tt class="py-comment"># Ensure it's data coming from the right place, for now we just</tt> </tt>
<a name="L384"></a><tt class="py-lineno">384</tt>  <tt class="py-line">            <tt class="py-comment">#  check the sending IP address. Ex: addr = ('10.10.10.2', 17754)</tt> </tt>
<a name="L385"></a><tt class="py-lineno">385</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">addr</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">dev</tt><tt class="py-op">:</tt> </tt>
<a name="L386"></a><tt class="py-lineno">386</tt>  <tt class="py-line">                <tt class="py-keyword">continue</tt> </tt>
<a name="L387"></a><tt class="py-lineno">387</tt>  <tt class="py-line">            <tt class="py-comment"># Dissect the UDP packet</tt> </tt>
<a name="L388"></a><tt class="py-lineno">388</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">,</tt> <tt class="py-name">ch</tt><tt class="py-op">,</tt> <tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-name">rssi</tt><tt class="py-op">,</tt> <tt class="py-name">lqival</tt><tt class="py-op">,</tt> <tt class="py-name">recdtime</tt><tt class="py-op">)</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-100" class="py-name" targets="Static Method killerbee.dev_wislab.WISLAB.__parse_zep_v2()=killerbee.dev_wislab.WISLAB-class.html#__parse_zep_v2"><a title="killerbee.dev_wislab.WISLAB.__parse_zep_v2" class="py-name" href="#" onclick="return doclink('link-100', '__parse_zep_v2', 'link-100');">__parse_zep_v2</a></tt><tt class="py-op">(</tt><tt id="link-101" class="py-name"><a title="killerbee.GoodFET.GoodFET.data" class="py-name" href="#" onclick="return doclink('link-101', 'data', 'link-87');">data</a></tt><tt class="py-op">)</tt> </tt>
<a name="L389"></a><tt class="py-lineno">389</tt>  <tt class="py-line">            <tt class="py-keyword">print</tt> <tt class="py-string">"Valid CRC"</tt><tt class="py-op">,</tt> <tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-string">"LQI"</tt><tt class="py-op">,</tt> <tt class="py-name">lqival</tt><tt class="py-op">,</tt> <tt class="py-string">"RSSI"</tt><tt class="py-op">,</tt> <tt class="py-name">rssi</tt> </tt>
<a name="L390"></a><tt class="py-lineno">390</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">frame</tt> <tt class="py-op">==</tt> <tt class="py-name">None</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt><tt class="py-name">ch</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt> <tt class="py-keyword">and</tt> <tt class="py-name">ch</tt> <tt class="py-op">!=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_channel</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L391"></a><tt class="py-lineno">391</tt>  <tt class="py-line">                <tt class="py-comment">#TODO this maybe should be an error condition, instead of ignored?</tt> </tt>
<a name="L392"></a><tt class="py-lineno">392</tt>  <tt class="py-line">                <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"ZEP parsing issue (bytes length={0}, channel={1})."</tt><tt class="py-op">.</tt><tt class="py-name">format</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">frame</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt class="py-name">frame</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt> <tt class="py-keyword">else</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">ch</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L393"></a><tt class="py-lineno">393</tt>  <tt class="py-line">                <tt class="py-keyword">continue</tt> </tt>
<a name="L394"></a><tt class="py-lineno">394</tt>  <tt class="py-line">            <tt class="py-keyword">break</tt> </tt>
<a name="L395"></a><tt class="py-lineno">395</tt>  <tt class="py-line"> </tt>
<a name="L396"></a><tt class="py-lineno">396</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">frame</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L397"></a><tt class="py-lineno">397</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<a name="L398"></a><tt class="py-lineno">398</tt>  <tt class="py-line"> </tt>
<a name="L399"></a><tt class="py-lineno">399</tt>  <tt class="py-line">        <tt class="py-comment">#Return in a nicer dictionary format, so we don't have to reference by number indicies.</tt> </tt>
<a name="L400"></a><tt class="py-lineno">400</tt>  <tt class="py-line">        <tt class="py-comment">#Note that 0,1,2 indicies inserted twice for backwards compatibility.</tt> </tt>
<a name="L401"></a><tt class="py-lineno">401</tt>  <tt class="py-line">        <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-name">frame</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-name">rssi</tt><tt class="py-op">,</tt> <tt class="py-string">'bytes'</tt><tt class="py-op">:</tt><tt class="py-name">frame</tt><tt class="py-op">,</tt> <tt class="py-string">'validcrc'</tt><tt class="py-op">:</tt><tt class="py-name">validcrc</tt><tt class="py-op">,</tt> <tt class="py-string">'rssi'</tt><tt class="py-op">:</tt><tt class="py-name">rssi</tt><tt class="py-op">,</tt> <tt class="py-string">'dbm'</tt><tt class="py-op">:</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-string">'location'</tt><tt class="py-op">:</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-string">'datetime'</tt><tt class="py-op">:</tt><tt class="py-name">recdtime</tt><tt class="py-op">}</tt> </tt>
<a name="L402"></a><tt class="py-lineno">402</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">rssi</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L403"></a><tt class="py-lineno">403</tt>  <tt class="py-line">            <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-string">'dbm'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">rssi</tt> <tt class="py-op">-</tt> <tt class="py-number">45</tt> <tt class="py-comment">#TODO tune specifically to the platform (expect antenna varriances?)</tt> </tt>
<a name="L404"></a><tt class="py-lineno">404</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L405"></a><tt class="py-lineno">405</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.jammer_on"></a><div id="WISLAB.jammer_on-def"><a name="L406"></a><tt class="py-lineno">406</tt> <a class="py-toggle" href="#" id="WISLAB.jammer_on-toggle" onclick="return toggle('WISLAB.jammer_on');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#jammer_on">jammer_on</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">channel</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.jammer_on-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.jammer_on-expanded"><a name="L407"></a><tt class="py-lineno">407</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L408"></a><tt class="py-lineno">408</tt>  <tt class="py-line"><tt class="py-docstring">        Not yet implemented.</tt> </tt>
<a name="L409"></a><tt class="py-lineno">409</tt>  <tt class="py-line"><tt class="py-docstring">        @type channel: Integer</tt> </tt>
<a name="L410"></a><tt class="py-lineno">410</tt>  <tt class="py-line"><tt class="py-docstring">        @param channel: Sets the channel, optional</tt> </tt>
<a name="L411"></a><tt class="py-lineno">411</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L412"></a><tt class="py-lineno">412</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L413"></a><tt class="py-lineno">413</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-102" class="py-name"><a title="killerbee.kbutils.KBCapabilities.require" class="py-name" href="#" onclick="return doclink('link-102', 'require', 'link-47');">require</a></tt><tt class="py-op">(</tt><tt id="link-103" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-103', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-104" class="py-name" targets="Variable killerbee.kbutils.KBCapabilities.PHYJAM=killerbee.kbutils.KBCapabilities-class.html#PHYJAM"><a title="killerbee.kbutils.KBCapabilities.PHYJAM" class="py-name" href="#" onclick="return doclink('link-104', 'PHYJAM', 'link-104');">PHYJAM</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L414"></a><tt class="py-lineno">414</tt>  <tt class="py-line"> </tt>
<a name="WISLAB.jammer_off"></a><div id="WISLAB.jammer_off-def"><a name="L415"></a><tt class="py-lineno">415</tt> <a class="py-toggle" href="#" id="WISLAB.jammer_off-toggle" onclick="return toggle('WISLAB.jammer_off');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="killerbee.dev_wislab.WISLAB-class.html#jammer_off">jammer_off</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">channel</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="WISLAB.jammer_off-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="WISLAB.jammer_off-expanded"><a name="L416"></a><tt class="py-lineno">416</tt>  <tt class="py-line">        <tt class="py-docstring">'''</tt> </tt>
<a name="L417"></a><tt class="py-lineno">417</tt>  <tt class="py-line"><tt class="py-docstring">        Not yet implemented.</tt> </tt>
<a name="L418"></a><tt class="py-lineno">418</tt>  <tt class="py-line"><tt class="py-docstring">        @return: None</tt> </tt>
<a name="L419"></a><tt class="py-lineno">419</tt>  <tt class="py-line"><tt class="py-docstring">        @rtype: None</tt> </tt>
<a name="L420"></a><tt class="py-lineno">420</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L421"></a><tt class="py-lineno">421</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">capabilities</tt><tt class="py-op">.</tt><tt id="link-105" class="py-name"><a title="killerbee.kbutils.KBCapabilities.require" class="py-name" href="#" onclick="return doclink('link-105', 'require', 'link-47');">require</a></tt><tt class="py-op">(</tt><tt id="link-106" class="py-name"><a title="killerbee.kbutils.KBCapabilities" class="py-name" href="#" onclick="return doclink('link-106', 'KBCapabilities', 'link-2');">KBCapabilities</a></tt><tt class="py-op">.</tt><tt id="link-107" class="py-name"><a title="killerbee.kbutils.KBCapabilities.PHYJAM" class="py-name" href="#" onclick="return doclink('link-107', 'PHYJAM', 'link-104');">PHYJAM</a></tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L422"></a><tt class="py-lineno">422</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="killerbee-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/killerbee/">KillerBee</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Dec 30 17:49:13 2013
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
